<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-change-edit" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input name="id" id="id" type="hidden" th:value="${emp.id}"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工号：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.badge}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">姓名：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.name}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同签约单位：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ContractTitle}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同类型：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ConTypeTitle}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同属性：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ConPropertyTitle}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同(年)：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ConTerm}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同属性：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ConPropertyTitle}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">合同结束日期：</label>
                    <div class="col-sm-8">
                        <input th:value="${emp.ConEndDate}" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">修改信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>解除日期：</label>
                    <div class="col-sm-8">
                        <input name="EffectDate" id="EffectDate" th:value="${emp.EffectDate}"
                               class="form-control laydate-demo-1" type="text" required/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">原因：</label>
                    <div class="col-sm-8">
                        <input name="reason" id="reason" th:value="${emp.reason}" class="form-control"
                               type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">备注：</label>
                    <div class="col-sm-8">
                        <input name="remark" id="remark" th:value="${emp.remark}" class="form-control"
                               type="text"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "contractManage/relieveContract";

    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });
    });



    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-change-edit").serializeArray();
            var id = $("#id").val();
            var EffectDate = $("#EffectDate").val();
            var reason = $("#reason").val();
            var remark = $("#remark").val();
            data.push({"name": "EffectDate", "value": EffectDate});
            data.push({"name": "reason", "value": reason});
            data.push({"name": "remark", "value": remark});
            $.operate.save(prefix + "/edit", data);
        }
    }

    function getConEndDate() {
        var ConBeginDate = $("#ConBeginDate").val();
        var ConTerm = $("#ConTerm").val();
        var date = new Date(ConBeginDate);
        $("#ConEndDate").val(date.getFullYear() + parseInt(ConTerm) + '-' + (date.getMonth() + 1) + '-' + date.getDate());
    }


</script>
</body>
</html>
